const mongoose = require("mongoose");

const userSchema = new mongoose.Schema({
  username: { type: String, required: true, unique: true },
  password: { type: String, required: true },
  // 可以继续扩展更多字段
  email: { type: String, required: true, unique: true },
  avatar: { type: String, default: "暂无头像" },
  role: { type: String, default: "user" },
  checkCode: { type: String, default: "" },
  // 过期时间30分钟
  checkCodeExpire: { type: Date, default: "" },
  // 刷新令牌
  refreshToken: { type: String, default: "" },
});

module.exports = mongoose.model("User", userSchema);
